﻿using System.Text;

namespace con01
{
    internal class Program1
    {
        static void Main(string[] args)
        {

            //xin2
            //xin666
            //合并 xin2与xin666
            //Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
            //var ss = Encoding.ASCII.GetBytes("@");
            byte b=0xFF;
            int s = b;
            Console.WriteLine($"{GetPoint(s)}");

        }
        /// <summary>
        /// 获取点位
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static byte[] GetPoint(int data)
        {
            //转为二进制字符串
            var inbyte1 = Convert.ToString(data, 2);
            //获取字节数组
            byte[] binaryByteArray = new byte[8];
            for (int i = 0; i < 8; i++)
            {
                if (i >= inbyte1.Length)
                {
                    binaryByteArray[i] = 0;
                    continue;
                }
                binaryByteArray[i] = (byte)int.Parse(inbyte1[inbyte1.Length - 1 - i].ToString());
            }
            return binaryByteArray;
        }


    }
}
